/*
 * http://www.roseindia.net/java/example/java/swing/DisplayImage.shtml
 */

package EXEMPLE;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
public class CadruImagine extends Panel {

    BufferedImage  image;

    public CadruImagine() {
    try {
         String imageName = "/home/depit/Desktop/lucian.jpg";
	 File input = new File(imageName);
	 image = ImageIO.read(input);
    } catch (IOException ie) {
      System.out.println("Error:"+ie.getMessage());
    }
  }

  public void paint(Graphics g) {
    g.drawImage( image, 0, 0, null);
  }

  static public void main(String args[]) throws Exception {
    JFrame fereastra = new JFrame("Display image");
    Panel panel = new CadruImagine();
    fereastra.getContentPane().add(panel);
    fereastra.setSize(500, 500);
    fereastra.setVisible(true);
  }
}
